package core.imust.com.kaoshi;

import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private MyDBHelper helper;
    private SQLiteDatabase db;
    private Button btnAdd;
    private Button Find;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        helper=new MyDBHelper(getApplicationContext());
        db=helper.getWritableDatabase();
        btnAdd=(Button)findViewById(R.id.btn_add);
        Find=(Button)findViewById(R.id.btn_find);
        btnAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                db.execSQL("insert into cdinfo(id,type) values(?,?)",new Object[]{"111","11"});
                db.execSQL("insert into cdinfo(id,type) values(?,?)",new Object[]{"112","12"});
            }
        });
        Find.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
    }
}
